package com.ruoyi.bussiness.controller;

import com.ruoyi.common.core.api.ApiResult;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.pagination.Paging;
import com.ruoyi.common.domain.business.Product;
import com.ruoyi.common.param.ProductParam;
import com.ruoyi.common.service.business.ProductService;
import com.ruoyi.common.vo.business.ProductVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品Controller
 *
 * @author Song
 * @date 2024-10-29
 */
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/common/product")
@Api(tags = "商品")
public class ProductController extends BaseController {

    private final ProductService productService;

    /**
     * 查询商品列表
     */
    @GetMapping("/page")
    @ApiOperation(value = "分页查询商品列表")
    public ApiResult<Paging<ProductVo>> page(ProductParam productParam) {
        Paging<ProductVo> page = productService.pageProduct(productParam);;
        return ApiResult.ok(page);
    }


}
